﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MiniExcelLibs.Attributes;

namespace thinger.MTHModels
{
    /// <summary>
    /// 通信参数
    /// </summary>
    public class Varlable
    {
        /// <summary>
        /// 参数名字
        /// </summary>
        public string VarName { get; set; }

        /// <summary>
        /// 参数类型
        /// </summary>
        public string DataType { get; set; }
        /// <summary>
        /// 位偏移或者长度（bool的位偏移，字符串的长度）
        /// </summary>
        public float OffsetOrLength { get; set; }

        /// <summary>
        /// 通信组的名字
        /// </summary>
        public string GroupName { get; set; }
        /// <summary>
        /// 起始索引
        /// </summary>
        public int Start { get; set; }

        /// <summary>
        /// 上升延报警
        /// </summary>
        public bool PosAlarm { get; set; }
        /// <summary>
        /// 下降沿报警
        /// </summary>
        public bool NegAlarm { get; set; }
        /// <summary>
        /// 转换系数
        /// </summary>
        public float VarScale { get; set; } = 1.0f;
        /// <summary>
        /// 偏移系数
        /// </summary>
        public float Offset { get; set; } = 0f;
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 变量的数值
        /// </summary>
        [ExcelIgnore]
        public object VarValue { get; set; }
        /// <summary>
        /// 上升延缓存
        /// </summary>
        [ExcelIgnore]
        public bool PosAlarmCache { get; set; } = false;
        /// <summary>
        /// 下降延缓存
        /// </summary>
        [ExcelIgnore]
        public bool NegAlarmCache { get; set; } = true;

    }
}
